﻿using System;
using System.ComponentModel;
using System.Data.Linq.Mapping;

namespace Data.MappingClasses
{
    [TableAttribute(Name = "dbo.Users")]
    public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private short _idUser;

        private string _userName;

        private string _userPassword;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnidUserChanging(short value);
        partial void OnidUserChanged();
        partial void OnuserNameChanging(string value);
        partial void OnuserNameChanged();
        partial void OnuserPasswordChanging(string value);
        partial void OnuserPasswordChanged();
        #endregion

        public User()
        {
            OnCreated();
        }

        [ColumnAttribute(Storage = "_idUser", AutoSync = AutoSync.OnInsert, DbType = "SmallInt NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public short idUser
        {
            get
            {
                return this._idUser;
            }
            set
            {
                if ((this._idUser != value))
                {
                    this.OnidUserChanging(value);
                    this.SendPropertyChanging();
                    this._idUser = value;
                    this.SendPropertyChanged("idUser");
                    this.OnidUserChanged();
                }
            }
        }

        [ColumnAttribute(Storage = "_userName", DbType = "VarChar(50) NOT NULL", CanBeNull = false)]
        public string userName
        {
            get
            {
                return this._userName;
            }
            set
            {
                if ((this._userName != value))
                {
                    this.OnuserNameChanging(value);
                    this.SendPropertyChanging();
                    this._userName = value;
                    this.SendPropertyChanged("userName");
                    this.OnuserNameChanged();
                }
            }
        }

        [ColumnAttribute(Storage = "_userPassword", DbType = "VarChar(50) NOT NULL", CanBeNull = false)]
        public string userPassword
        {
            get
            {
                return this._userPassword;
            }
            set
            {
                if ((this._userPassword != value))
                {
                    this.OnuserPasswordChanging(value);
                    this.SendPropertyChanging();
                    this._userPassword = value;
                    this.SendPropertyChanged("userPassword");
                    this.OnuserPasswordChanged();
                }
            }
        }

        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}